

<template>
  <div>
    <!-- 右侧菜单 -->

    <a-col :md="24" class="navLeftTop-a">部门人员</a-col>
    <a-col :md="24">
      <a-form layout="inline">
        <a-row :gutter="48">
          <a-col :md="24" :sm="24">
            <a-form-item label style="float:left; padding:0">
              <a-input-search
                style="width:300px"
                v-model="queryParam.memberId"
                placeholder="请输入角色名称/代码"
              />
            </a-form-item>
            <a-col :md="10" :sm="24" style="float:left; padding:0;margin-top:3px">
              <span>
                <a-button type="primary" @click="loadDataRefresh()">搜索</a-button>
              </span>
            </a-col>
          </a-col>
        </a-row>
      </a-form>
      <a-card :bordered="false">
        <s-table
          ref="table"
          size="default"
          :bordered="true"
          :columns="columns"
          :data="loadData"
          :alert="false"
          showPagination="auto"
        ></s-table>
      </a-card>
    </a-col>
  </div>
</template>

<script>
import { STable, Ellipsis } from '@/components'
import { putAction, postAction, getAction } from '@/api/manage'
const columns = [
  {
    title: '序号',
    align: 'center',
    width: '80',
    dataIndex: 'member.id',
  },
  {
    title: '工号',
    dataIndex: 'createTime',
    width: '180',
    align: 'center',
  },
  {
    title: '姓名',
    dataIndex: 'username',
    width: '180',
    align: 'center',
  },
  {
    title: '手机号',
    dataIndex: 'phone',
    width: '180',
    align: 'center',
  },
  {
    title: '邮箱',
    dataIndex: 'email',
    width: '180',
    align: 'center',
  },
  {
    title: '角色',
    dataIndex: 'detail',
    width: '180',
    align: 'center',
  },
  {
    title: '岗位',
    dataIndex: 'emergencyRelation',
    width: '180',
    align: 'center',
  },
  {
    title: '部门',
    dataIndex: 'address',
    ellipsis: true,
    width: '250',
    align: 'center',
  },
]

export default {
  name: 'Data-b',
  components: {
    STable,
    Ellipsis,
  },
  data() {
    this.columns = columns
    return {
      currentNav: '组织管理',
      visible: false,
      confirmLoading: false,
      mdl: null,
      // 高级搜索 展开/关闭
      advanced: false,
      // 查询参数
      queryParam: { keywords: '', certifiedBusinessStatus: '', startTime: '', endTime: '', memberId: '' },
      // 加载数据方法 必须为 Promise 对象
      loadData: (parameter) => {
        const requestParameters = Object.assign({ sort: 'createTime,desc' }, parameter, this.queryParam)
        console.log('loadData request parameters:', requestParameters)
        return getAction('/api/businessAuthApply', requestParameters).then((res) => {
          return {
            ...requestParameters,
            totalCount: res.result.totalElements,
            totalPage: 10,
            data: res.result.content,
          }
        })
      },
      selectedRowKeys: [],
      selectedRows: [],
    }
  },

  computed: {
    rowSelection() {
      return {
        selectedRowKeys: this.selectedRowKeys,
        onChange: this.onSelectChange,
      }
    },
  },
  filters: {
    statusFilter(type) {
      return statusMap[type].text
    },
    statusTypeFilter(type) {
      return statusMap[type].status
    },
  },
  methods: {
    callback(key) {
      console.log(key)
    },
    handleChange(value) {
      // this.queryParam.clientType = value
      console.log(this.queryParam.clientType)
      this.loadDataRefresh()
    },

    lookLink(record) {
      console.log(record)
    },
    onSelectChange(selectedRowKeys, selectedRows) {
      this.selectedRowKeys = selectedRowKeys
      this.selectedRows = selectedRows
    },
    loadDataRefresh() {
      this.$refs.table.refresh() // refresh() 不传参默认值 false 不刷新到分页第一页
    },
    onSelect(keys, event) {
      console.log('Trigger Select', keys, event)
    },
  },
}
</script>
<style  lang="less">
.navLeftTop-a {
  height: 50px;
  line-height: 50px;
  font-size: 22px;
  padding: 0 0 0 15px;
  color: #2f2f2f;
  font-family: Source Han Sans SC;
  font-weight: 500;
}
.asideTop-a {
  background-color: #fff;
  height: 300px;
  display: flex;
  align-items: center;
  .ant-col-md-24 {
    margin: 10px 0 5px 0;
    .ant-col-md-3 {
      text-align: right;
      font-size: 16px;
      font-family: Source Han Sans SC;
      color: #2f2f2f;
    }
  }
}
.mt20 {
  margin-top: 20px !important;
}
</style>
